package com.zero.ribbon.web.controller;

import com.zero.ribbon.web.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ClientController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping
    public String index(){
        String url = "http://127.0.0.1:9090/greeting";
        User user = new User();
        user.setId(1l);
        user.setName("wql");
        return restTemplate.postForObject(url,user,String.class);
    }
}
